import { defineStore } from 'pinia';
import axios from "axios";
const useMdStore = defineStore({
    id: 'md',
    state: () => ({
        date : {},
        subDetailinfo:{}
    }),
    // 开启数据缓存
    getters: {
        getDate(state) {
            return state.date;
        },
        getSubDetailinfo(state) {
            return state.subDetailinfo;
        }
    },
    actions: {
        setDate(date: any) {
            this.date = date;
            axios.get('http://localhost:8081/infoResMdInfo/detailinfo',{
                params: {
                    Name : date.mdContact
                }
            }).then((res) => {
                this.subDetailinfo = res.data.data[0]
            })
        },
    },
    persist: true,
});

export default useMdStore;
